package com.kingyun.gpsinspection.purificationservice.services.jsm.innerservice.impl.operatingunitform;

import com.kingyun.gpsinspection.purificationservice.dao.mapper.jsm.RadioTypeMapper;
import com.kingyun.gpsinspection.purificationservice.facade.model.jsm.RadioType;
import com.kingyun.gpsinspection.purificationservice.facade.service.jsm.operatingunitform.JsmRadioTypeService;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

/**
 * Created by zmling on 2016/12/20.
 * 单项框类型信息
 */

public class JsmRadioTypeServiceImpl implements JsmRadioTypeService {

    @Autowired
    private RadioTypeMapper radioTypeMapper;

    @Override
    public List<RadioType> findRadioType() throws Exception {
        String dataItemId = "";
        List<RadioType> list = radioTypeMapper.findradioType(dataItemId);
        if (list.size() > 0) {
            for (RadioType li : list) {
                if (li.getRadioTypeName() != null && li.getRadioTypeName() != "") {
                    String str[] = li.getRadioTypeName().split(",");
                    for (int i = 0; i < str.length; i++) {
                        if (i == 0) {
                            li.setTypeName1(str[i]);
                        } else if (i == 1) {
                            li.setTypeName2(str[i]);
                        }
                    }
                }
            }
        }
        return list;
    }
}
